package org.example.journal_items.Exception;



public enum ErrorCode {
    // 通用错误
    SUCCESS(200, "成功"),
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),

    // 用户相关错误
    USER_NOT_FOUND(1001, "用户不存在"),
    USER_ALREADY_EXISTS(1002, "用户已存在"),
    INVALID_PASSWORD(1003, "密码错误"),
    USER_NOT_LOGIN(1004, "用户未登录"),

    // 日记相关错误
    DIARY_NOT_FOUND(2001, "日记不存在"),
    DIARY_CREATE_FAILED(2002, "创建日记失败"),
    DIARY_UPDATE_FAILED(2003, "更新日记失败"),
    DIARY_DELETE_FAILED(2004, "删除日记失败");

    private final int code;
    private final String message;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}